function [ergodic,outage]=homework1(nr,nt,correl1,correl2,snr_db,large_number,outage_r)

if(nargin<1)
nr=[2 4 8];
nt=[2 4 8];
correl1=0;
correl2=0;
snr_db=10;
large_number=20;
outage_r=.05;
end

snr=10.^(snr_db/10);

outage=zeros(length(nr),length(snr));
ergodic=zeros(length(nr),length(snr));

for a=1:length(nr)
a
	cap=zeros(length(snr),large_number);
	for b=1:length(snr)
	b
		for m=1:large_number
			h=correlated_channel(nr(a),nt(a),correl1, correl2);
			cap(b,m)=capacity(h,nr(a),nt(a),snr(b));
		end
	end
	ergodic(a,:)=real(mean(cap,2));
	x=sort(cap,2);
	outage(a,:)=real(x(:,floor(large_number*outage_r)));
	
end


